var style = [
     {t:-64,s:.83,z:1},
     {t:140,s:1,z:2},
     {t:338,s:.83,z:1},
     {t:960,s:.83,z:1},
     {t:960,s:.83,z:1},
     {t:960,s:.83,z:1},
]
var swiperWrapper = document.querySelectorAll('section.swiper .swiper-wrapper .swiper-slide ')
var changeImg = function(){
    swiperWrapper.forEach(function(item,i){
        item.style.transform='translateX('+style[i].t+'px) scale('+style[i].s+')'
        item.style.zIndex=style[i].z
    })
}
changeImg()

var changeNext = function(){
    var temp = style.pop()
    style.unshift(temp)
    changeImg()
}
var changePrev = function(){
    var temp = style.shift()
    style.push(temp)
    changeImg()
}
var t2
function t22(){t2 = setInterval(function(){
    changeNext()
}, 2000);}
t22()
var prevObj = document.querySelector('section.swiper .swiper-prev')
var nextObj = document.querySelector('section.swiper .swiper-next')
prevObj.onmouseover=nextObj.onmouseover=function(){
    clearInterval(t2)
}
prevObj.onmouseout=nextObj.onmouseout=function(){
    t22()
}
prevObj.onclick=function(){
    changePrev()
}
nextObj.onclick=function () {
    changeNext()
}
swiperWrapper.forEach(function(item,i){
    item.onmouseover=function(){
        clearInterval(t2)
    }
    item.onmouseout=function(){
        t22()
    }
    item.onclick=function(){
        var translateXObj = this.style.transform
        if (translateXObj.indexOf("64px")!=-1) {
            changePrev()
        }
        if (translateXObj.indexOf("338px")!=-1) {
            changeNext()
        }
    }
})
